package com.aimei.security.provider;

import com.aimei.security.authentication.UserAuthentication;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.stereotype.Component;

/**
 * @author xiah
 * @date 2018/5/5 16:01
 */
@Component
public class UserAuthenticationProvider implements AuthenticationProvider{
       @Override
       public Authentication authenticate(Authentication authentication) throws AuthenticationException {
              authentication.setAuthenticated(true);
              return authentication;
       }

       @Override
       public boolean supports(Class<?> authentication) {
              return (UserAuthentication.class.isAssignableFrom(authentication));
       }
}
